An immutable map of key/value pairs implemented as a balanced binary tree
Based on Haskell's Data.Map
- Since
7.0.3
- Companion
- object
Value members
Concrete methods
if the key exists, transforms its value - O(log n)
if the key exists, transforms its value - O(log n)
inserts a new key/value - O(log n).
inserts a new key/value - O(log n).
If the key is already present, its value is replaced by the provided value.
inserts a new key/value pair, resolving the conflict if the key already exists - O(log n)
inserts a new key/value pair, resolving the conflict if the key already exists - O(log n)
- Value Params
- f
function to resolve conflict with existing key: (insertedValue, existingValue) => resolvedValue
- kx
key
- x
value to insert if the key is not already present
inserts a new key/value pair, resolving the conflict if the key already exists - O(log n)
inserts a new key/value pair, resolving the conflict if the key already exists - O(log n)
- Value Params
- f
function to resolve conflict with existing key: (key, insertedValue, existingValue) => resolvedValue
- kx
key
- x
value to insert if the key is not already present
returns true
if this map contains no key/value pairs - O(1)
returns true
if this map contains no key/value pairs - O(1)
updates or removes a value - O(log n)
updates or removes a value - O(log n)
if f
returns None
, then the key is removed from the map
insert v into the map at k. If there is already a value for k, append to the existing value using the Semigroup
insert v into the map at k. If there is already a value for k, append to the existing value using the Semigroup
looks up a key and updates its value - O(log n)
looks up a key and updates its value - O(log n)
Similar to updateWithKey but also returns the value. If the value was updated, returns the new value. If the value was deleted, returns the old value.